number of good pairs leetcode solution